﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.Common;
using System.Data.SqlClient;

/// <summary>
/// Summary description for CtrlBDRole
/// </summary>
public class CtrlBDRole
{
	String strConnect;
    String strSql;
    SqlConnection connection;
    SqlDataAdapter adapter;
    DataSet dataSet;

    /// <summary>
    /// Constructor vacío.
    /// </summary>
    public CtrlBDRole()
	{
        strConnect = ConfigurationManager.ConnectionStrings["conexion"].ConnectionString;
        connection = new SqlConnection(strConnect);
	}

    /// <summary>
    /// Devuelve un dataset con la consulta hecha, solamente Id y Nombre de todos los proyectos.
    /// </summary>
    public DataSet getData()
    {
        dataSet = new DataSet();

        connection.Open();
        strSql = "SELECT * FROM Role";
        adapter = new SqlDataAdapter(strSql, connection);
        adapter.Fill(dataSet, "Role");
        connection.Close();
        return dataSet;
    }
}
